<?php
require("../config.php");

if ($_SERVER['REQUEST_METHOD'] == 'POST')
	{
		$uname = $class_go->C_title($_REQUEST['set']);
		$fname = $class_go->C_title($_REQUEST['wname']);
		$fnum = $class_go->C_title($_REQUEST['wnum']);
		$fprice = $class_go->C_title($_REQUEST['wprice']);
		//$btime = time();
		$uid = $udb->sqls("select user_id from user_table where user_name='$uname'");
		if($uid != null)
		{
			$uid = $uid[0]["user_id"];
			
			$sqlset = $udb->sqls("insert into freight_table (uid,freight_name,freight_num,freight_price,sign) values ($uid,'$fname',$fnum,$fprice,0)");
			$udb->sqls("insert into sale_table (fid,uid,fname,fnum,fprice,sign) values ($sqlset,$uid,'$fname',$fnum,$fprice,0)");	
			if ($sqlset != null)
			{
				echo "<script language=\"JavaScript\">alert(\"填加商品成功!!\");</script>"; 
				echo "\n<!--Start header -->\n";
				require("../html/head.html");
				echo "\n<!--End header -->\n";
				echo "\n<!--Start Content -->\n";
				require("../html/add_goods.html");
				echo "\n<!--End Content -->\n";
				echo "\n<!--Start Foot -->\n";
				require("../html/foot.html");
				echo "\n<!--End Foot -->\n";
			}
			else
			{
				echo "填加商品失败!";
				echo "\n<!--Start header -->\n";
				require("../html/head.html");
				echo "\n<!--End header -->\n";
				echo "\n<!--Start Content -->\n";
				require("../html/add_goods.html");
				echo "\n<!--End Content -->\n";
				echo "\n<!--Start Foot -->\n";
				require("../html/foot.html");
				echo "\n<!--End Foot -->\n";
			}
		}
	}
?>